﻿using System;
using System.Windows.Forms;

namespace Administracja
{
    public partial class Logowanie : Form
    {
        public bool IsOk { get; private set; }

        public Logowanie()
        {
            InitializeComponent();
        }

        private void ZalogujClick(object sender, EventArgs e)
        {
            if (login.Text == "ela" & haslo.Text == "asia")
            {
                IsOk = true;
                Close();
            }
            else
            {
                IsOk = false;
                Wyjatki.Komunikat("Błędne hasło lub login.", "Błąd logowania.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void AnulujClick(object sender, EventArgs e)
        {
            IsOk = false;
            Application.Exit();
        }

        private void CheckKeys(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                ZalogujClick(this, EventArgs.Empty);
                e.KeyChar = (char)0;
            }
        }
    }
}
